#include "MutexWin32.hpp"

namespace RevEng
{ 
	MutexWin32::MutexWin32()
	{
		InitializeCriticalSection(&m_Cs);
	}


	MutexWin32::~MutexWin32()
	{
		DeleteCriticalSection(&m_Cs);
	}


	void MutexWin32::Lock()
	{
		EnterCriticalSection(&m_Cs);
	}

	void MutexWin32::Unlock()
	{
		LeaveCriticalSection(&m_Cs);
	}


	bool MutexWin32::TryLock()
	{
		return (TryEnterCriticalSection(&m_Cs) == TRUE);
	}
}
